<%@ tag body-content="empty" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="cf" uri="http://kyub.com/jsp/jstl/functions" %>
<%@ attribute name="propertyName" required="true" %>
<%@ attribute name="path" required="true" %>
<%@ attribute name="pojoDescriptor" required="false" type="com.kyub.spring.gears.model.PojoDescriptor" %>
<%@ attribute name="pojo" required="true" type="java.lang.Object" %>
<%@ attribute name="gears_restfull_prefix" required="false" %>


<c:if test="${empty path}">
    <h4>File Upload</h4>


    <form:form commandName="commandUpload" method="POST"
               id="uploadForm"
               action="${pageContext.request.contextPath}/${gears_restfull_prefix}/${pojoDescriptor.name}/executeupload/${cf:readProperty(commandPojo,pojoDescriptor.idProperty)}/${p.name}"
               enctype="multipart/form-data" cssClass="thickbox">

        <input type="file" name="file" value="Upload File">
        <input type="submit" value="Upload">
    </form:form>

    <div id="theMeter">
        <div id="progressBarText"></div>

        <div id="progressBarBox">
            <div id="progressBarBoxContent"></div>
        </div>
    </div>
    <div id="output2">

    </div>
</c:if>
<c:if test="${not empty path}">
    <spring:message code="uploadDoneLabel" text="Upload Done"
                    htmlEscape="true"/>

    <input type="hidden" value="${path}" name="uploaded_path_${propertyName}" id="uploaded_path_${propertyName}"/>
</c:if>